<html>
<body>
<?php
function hex_color($max_r,$max_g,$max_b)
{
	// ensure that values are in the range between 0 and 255
	if ($max_r > 255) { $max_r = 255; }
	if ($max_g > 255) { $max_g = 255; }
	if ($max_b > 255) { $max_b = 255; }
	if ($max_r < 0) { $max_r = 0; }
	if ($max_g < 0) { $max_g = 0; }
	if ($max_b < 0) { $max_b = 0; }
	return dechex($max_r) . dechex($max_g) . dechex($max_b);
}
$color = array(	0 => array( "r" => 255,"g" => 0,"b" => 0),
				1 => array( "r" => 255,"g" => 0,"b" => 255),
				2 => array( "r" => 0,"g" => 0,"b" => 255),
				3 => array( "r" => 0,"g" => 255,"b" => 255),
				4 => array( "r" => 0,"g" => 255,"b" => 0),
				5 => array( "r" => 255,"g" => 255,"b" => 0),
				6 => array( "r" => 0,"g" => 0,"b" => 0));

echo'<table>' . "\n";
for($i = 0; $i < 200; $i=$i+2)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255,255-($k+$i),255-($k+$i));
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}

for($i = 0; $i < 50; $i=$i+10)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255,255-$k,255);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}

for($i = 0; $i < 50; $i=$i+10)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255,255,255-$k);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}

for($i = 0; $i < 50; $i=$i+10)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255-$k,255,255-$k);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}
for($i = 0; $i < 50; $i=$i+10)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255-$k,255,255);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}
for($i = 0; $i < 50; $i=$i+10)
{
	echo '<tr>';
		for($k = 0; $k < 240; $k=$k+10){
			$hex = hex_color(255-$k,255-$k,255);
			echo '<td bgcolor="#' . $hex . '">#' . $hex . '</td>';
		}
	echo'</tr>';
}


echo'</table>';

?>
</body>
</html>
